﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="SubscribersMsgs.aspx.cs" Inherits="SubscribersMsgs" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>
<%@ Register Src="~/Sendmail.ascx" TagName="Sendmail" TagPrefix="SM" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>بريد النظام الوارد</title>
    <script src="jqModal.js" type="text/javascript"></script>
    <script type="text/javascript">

    function there() {

        $("#dialog").jqm({ modal: true }).jqmShow();


    }
    function quickread(RowIndex) {
    
    
        var x = document.getElementById(RowIndex); //
   
        var y = document.getElementById('Text1');

        y.innerHTML = htmlDecode(x.value);

    }
    function htmlEncode(value) {
        return $('<div/>').text(value).html();
    }

    function htmlDecode(value) {
        return $('<div/>').html(value).text();
    }

    function GetCellValue(RowIndex) {


        window.open("mailindetails.aspx?index=" + RowIndex, '_blank');


    }
 </script>
    <style type="text/css">
          .zr3 {
	background-image:url('images/button2.png');
	display:block;
	float:right;
	 padding: 0px 10px 0px 10px;
	height:21px;
	text-align:center;
	color:#fff;
	text-shadow:1px 1px 0px #003a5e;
	margin-right:2px;
	line-height:19px;
	font-weight:bold;
	text-decoration:none;
	font-family:Tahoma;
	font-size:12px;


}
.zr3:hover ,.zr3:active {
	background-image:url('images/button2.png');
	text-shadow:1px 1px 0px #003a5e;
	background-position:0px -21px;
	
}
  .stylelabel3
       {
       	color:#064c66;
	 font-weight:bold;
	 direction:rtl;
	 text-align:right;
       	}
             .tab3{
	width:815px;
 direction:rtl;
 border:1px #ccc solid;
 border-radius:5px;
 }

tr .tabbone3{
	 background-color:#028ac5;
	 font-size:11px;
	 line-height:20px;
	 font-family:Tahoma;
  	 color:#fff;
  	 text-align:center;
	
}
 .req3
       {
           color:Red;
       } 
.adel3{
	background-color:#ededed;
	font-size:10px;
	color:#084f86;
	font-family:Tahoma;
	height:30px;
	text-align:  center;
}
.he3{
	background-color:#fff;
	padding:5px;
	font-family:Tahoma;
	font-size:14px;
	font-weight:bold;
       
}
        .jqmWindow {
    display: none;
    
    position: fixed;
    top: 15%;
    left: 42%;
    
    margin-left: -300px;
    width: 800px;
    
    background-color: #fff;
    color: #333;
    border: 1px solid black;
    padding: 12px;
}

.jqmOverlay { background-color: #000; }

/* Fixed posistioning emulation for IE6
     Star selector used to hide definition from browsers other than IE6
     For valid CSS, use a conditional include instead */
* html .jqmWindow 
{
     position: absolute;
     top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
}
            </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
    <asp:UpdatePanel ID="up1" runat="server" RenderMode="Inline">
    <ContentTemplate>
             <table >
     <tr >
       <td align="right">   
            <asp:Label  CssClass="stylelabel3" ID="newmail" runat="server" Text="رسائل المشتركين للمتابعات اليومية " meta:resourceKey="Lablcss"></asp:Label>
            </td>
            </tr>
             <tr>
<td > 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
              DeleteCommand="delete [messages] where id = @msgid"
              SelectCommand="select d.id as msgid, d.*,g.*,t.company,t.email1 ,g.id as mysub from  [messages] d inner JOIN daily_checking g on (d.daily_checking_id = g.id)  INNER JOIN companies t ON (d.company_id = t.id)  WHERE  d.daily_checking_id >=0 and d.checked=0 order by d.id desc">
              
       
    </asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" 
        DataSourceID="SqlDataSource1" 
        AutoGenerateColumns="False" DataKeyNames="msgid" 
       OnRowCreated="GridView1_RowCreated" 
        onrowdatabound="GridView1_RowDataBound" GridLines="None" 
        EnableModelValidation="True" meta:resourcekey="GridView1Resource1" >
        <Columns>
         <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                            <HeaderTemplate>
                                <div >
                                    <table class="tab3">
                                        <tr>
                                        <td class="tabbone3" style="width:100px">
                                                <asp:Label ID="lblstartofsubs" runat="server" Text="العنوان" meta:resourceKey="title"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3" style="width:220px">
                                                <asp:Label ID="lblstops" runat="server" Text="الرسالة" meta:resourceKey="message" Width="60px" />
                                            </td>
                                            <td class="tabbone3" style="width:100px">
                                                <asp:Label ID="Label3" runat="server" Text="الشركة" meta:resourceKey="company"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:100px">
                                                <asp:Label ID="lblendofsubs" runat="server" Text="تاريخ الارسال" meta:resourceKey="dates"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:100px">
                                                <asp:Label ID="Label2" runat="server" Text="تاريخ الاستلام" meta:resourceKey="delv"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:100px">
                                                <asp:Label ID="Label4" runat="server" meta:resourceKey="issue"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:75px">
                                                 <asp:Label ID="Label10" runat="server" Text="متابعة" meta:resourceKey="lblshow" />
                                            </td>
                                            <td class="tabbone3"style="width:20px">
                                                 <asp:Label ID="Label8" runat="server"  />
                                            </td>
                                            </tr>
                                    </table>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <table class="tab3">
                                    <tr>
                                    <td class="adel3" style="width:100px">
                                            <asp:Label  ID="startofsub" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("title"))) %>'
                                                Width="60px" meta:resourcekey="startofsubResource1" />
                                        </td>
                                       <td class="adel3"style="width:220px">
                                            <asp:Label   ID="txt" runat="server" 
                                                Text='<%# (Eval("message").ToString().Length>=30) ? Eval("message").ToString().Substring(0,30)+"..." :Eval("message").ToString() %>' meta:resourcekey="txtResource1"
                                             />
                                            
                                            <input id="msg" runat="server" type="hidden" value='<%# HttpUtility.HtmlEncode(Eval("message").ToString()) %>' />
                                            </input>
                                        </td>
                                        <td class="adel3" style="width:100px">
                                            <asp:Label  ID="Label5" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("company"))) %>'
                                                Width="60px" meta:resourcekey="Label5Resource1" />
                                        </td>
                                        <td class="adel3"style="width:100px">
                                            <asp:Label  ID="Label11" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("datesent"))) %>'
                                                Width="60px" meta:resourcekey="Label11Resource1" />
                                        </td>
                                        <td class="adel3" style="width:100px">
                                            <asp:Label  ID="Label6" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("delivered"))) %>'
                                                Width="60px" meta:resourcekey="Label6Resource1" />
                                        </td>
                                    <td class="adel3"style="width:100px">
                                            <asp:Label  ID="Label7" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("issuedate"))) %>'
                                                Width="60px" meta:resourcekey="Label7Resource1" />
                                        </td>
                                             <td class="adel3"style="width:75px">
                                           <asp:LinkButton runat="server" ID="edits" Text='ارسال ميل' meta:resourceKey="lblshow" ToolTip='<%# Eval("email1").ToString()%>' CommandArgument='<%#Eval("company_id").ToString() %>'  OnClick="edit2_Click"   />
                                        </td >    
                                            <td class="adel3"style="width:20px">
                                           <asp:LinkButton runat="server" ID="Delete1" Text='X'  CommandName="Delete"    />
                                         <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" 
                                                    ConfirmText="<%$ Resources:Resource, delconfirm %>" TargetControlID="Delete1" />
                                        </td >                              
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateField>
              
        </Columns>
       
        <EmptyDataTemplate>
            <asp:Label ID="Label12" CssClass="he3"  runat="server" 
                Text="لايوجد رسائل مشتركين" meta:resourcekey="Label12Resource1"></asp:Label>
        </EmptyDataTemplate>
       
    </asp:GridView>
 </td>
    </tr>
      <tr dir="rtl">
       <td>   
            <asp:Label  CssClass="stylelabel3" ID="Label1" runat="server" Text="رسائل وردود المشتركين" meta:resourceKey="newmail"></asp:Label>
            </td>
            </tr>
             <tr>
<td > 
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
              DeleteCommand="delete [messages] where id = @msgid"
              SelectCommand="select d.id as msgid, d.*,t.company,t.email1 from  [messages] d  INNER JOIN companies t ON (d.company_id = t.id)  WHERE  d.reply_id >=0 and d.checked=0 order by d.id desc">
       
       
    </asp:SqlDataSource>
<asp:GridView ID="GridView2" runat="server" 
        DataSourceID="SqlDataSource2" 
        AutoGenerateColumns="False" DataKeyNames="msgid" 
       OnRowCreated="GridView2_RowCreated" onrowdatabound="GridView2_RowDataBound" 
        GridLines="None" EnableModelValidation="True" 
        meta:resourcekey="GridView2Resource1">
        <Columns>
         <asp:TemplateField meta:resourcekey="TemplateFieldResource2">
                            <HeaderTemplate>
                                <div >
                                    <table class="tab3">
                                        <tr>
                                        <td class="tabbone3" style="width:150px">
                                                <asp:Label ID="lblstartofsubs" runat="server" Text="العنوان" meta:resourceKey="title"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:300px">
                                                <asp:Label ID="lblstops" runat="server" Text="الرسالة" meta:resourceKey="message" Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:100px">
                                                <asp:Label ID="Label3" runat="server" Text="الشركة" meta:resourceKey="company"
                                                    Width="60px" />
                                            </td>
                                            <td class="tabbone3"style="width:100px" >
                                                <asp:Label ID="lblendofsubs" runat="server" Text="تاريخ الإرسال" meta:resourceKey="dates"
                                                    Width="60px" />
                                            </td>
                                           <td class="tabbone3"style="width:75px">
                                                <asp:Label ID="Label2" runat="server" meta:resourceKey="replyornew"
                                                    Width="60px" />
                                            </td>

 <td class="tabbone3"style="width:75px">
                                                 <asp:Label ID="Label10" runat="server" Text="متابعة" meta:resourceKey="lblshow" />
                                            </td>
                                            <td class="tabbone3"style="width:20px">
                                                 <asp:Label ID="Label9" runat="server"  />
                                            </td>
                                            </tr>
                                    </table>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <table class="tab3">
                                    <tr>
                                    <td class="adel3" style="width:150px">
                                            <asp:Label  ID="startofsub" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("title"))) %>'
                                                Width="60px" meta:resourcekey="startofsubResource2" />
                                        </td>
                                        <td class="adel3"style="width:280px">
                                            <asp:Label   ID="txt" runat="server" 
                                                Text='<%# (Eval("message").ToString().Length>=30) ? HttpUtility.HtmlEncode((Eval("message").ToString().Substring(0,30)))+"..." :HttpUtility.HtmlEncode(Eval("message").ToString()) %>' meta:resourcekey="txtResource2"
                                             />
                                            
                                            <input id="msg" runat="server" type="hidden" value='<%# HttpUtility.HtmlEncode(Eval("message").ToString()) %>' />
                                            </input>
                                        </td>
                                        <td class="adel3"style="width:100px">
                                            <asp:Label  ID="Label5" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("company"))) %>'
                                                Width="60px" meta:resourcekey="Label5Resource2" />
                                        </td>
                                        <td class="adel3"style="width:100px">
                                            <asp:Label  ID="Label11" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("datesent"))) %>'
                                                Width="60px" meta:resourcekey="Label11Resource2" />
                                        </td>
                                          <td class="adel3"style="width:75px">
                                            <asp:Label  ID="reps" runat="server" ToolTip='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("reply_id"))) %>'
                                                Width="60px" meta:resourcekey="repsResource1" />
                                        </td >
                                         <td class="adel3"style="width:75px">
                                           <asp:LinkButton runat="server" ID="edits" ToolTip='<%#Eval("email1").ToString() %>' Text='ارسال ميل' meta:resourceKey="lblshow"  CommandArgument='<%#Eval("company_id").ToString() %>'  OnClick="edit2_Click"   />
                                        </td >
                                        <td class="adel3"style="width:20px">
                                           <asp:LinkButton runat="server" ID="Delete2" Text='X'  CommandName="Delete"    />
                                         <asp:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" 
                                                    ConfirmText="<%$ Resources:Resource, delconfirm %>" TargetControlID="Delete2" />
                                        </td >  
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateField>
              
            
        </Columns>
       
        <EmptyDataTemplate>
            <asp:Label ID="Label13" CssClass="stylelabel3" runat="server" 
                Text="لايوجد رسائل" meta:resourcekey="Label13Resource1"></asp:Label>
        </EmptyDataTemplate>
       
    </asp:GridView>
 </td>
    </tr>
    <tr>
      <td>
   <div dir="rtl">
    <div id="Text1" class="tab3" style="height:500px;overflow:auto" ></div>
    </div>
       </td>
   </tr>
    </table>
     </ContentTemplate>
    </asp:UpdatePanel>
<div class="jqmWindow" id="dialog">

<a href="#" class="jqmClose" style="background-image:url('images/close.png');
	 width:39px;
	 height:40px;
	  background-repeat:no-repeat;
	  display:block;
	  float:left;	"></a>

 <sm:sendmail ID="Sendmail1" runat="server" />
</div>

</asp:Content>

